home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIRegistry.idl < prev    next >
Text File  |  2006-05-08  |  8KB  |  187 lines

  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org Code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1999
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #include "nsISupports.idl"
  38. #include "nsIEnumerator.idl"
  39.  
  40. interface nsIFile;
  41.  
  42. typedef PRUint32 nsRegistryKey;
  43. typedef long     nsWellKnownRegistry;
  44.  
  45. [scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)]
  46. interface nsIRegistry : nsISupports
  47. {
  48.     const long None = 0;
  49.     const long Users = 1;
  50.     const long Common = 2;
  51.     const long CurrentUser = 3;
  52.  
  53.     const long ApplicationComponentRegistry = 1;
  54.     const long ApplicationRegistry = 2;
  55.  
  56.     // Dont use this one. This for internal use only.
  57.     const long ApplicationCustomRegistry = -1;
  58.  
  59.     void open(in nsIFile regFile);
  60.     void openWellKnownRegistry(in nsWellKnownRegistry regid);
  61.  
  62.     void flush();
  63.     boolean isOpen();
  64.     
  65.     nsRegistryKey addKey(in nsRegistryKey baseKey, in wstring keyname);
  66.     nsRegistryKey getKey(in nsRegistryKey baseKey, in wstring keyname);
  67.     void removeKey(in nsRegistryKey baseKey, in wstring keyname);
  68.  
  69.     wstring getString(in nsRegistryKey baseKey, in wstring valname);
  70.     void setString(in nsRegistryKey baseKey, in wstring valname, in wstring value);
  71.  
  72.     string getStringUTF8(in nsRegistryKey baseKey, in string path);
  73.     void setStringUTF8(in nsRegistryKey baseKey, in string path, in string value);
  74.  
  75.     void getBytesUTF8(in nsRegistryKey baseKey, in string path, out PRUint32 length, [retval, array, size_is(length)] out PRUint8 valueArray);
  76.     void setBytesUTF8(in nsRegistryKey baseKey, in string path, in PRUint32 length, [array, size_is(length)] in PRUint8 valueArray);
  77.     PRInt32 getInt(in nsRegistryKey baseKey, in string path);
  78.     void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value);
  79.     PRInt64 getLongLong(in nsRegistryKey baseKey, in string path);
  80.     void setLongLong(in nsRegistryKey baseKey, in string path, inout PRInt64 value);
  81.  
  82.     /**
  83.      * addSubtree() and friends need to be renamed to addKeyUTF8().
  84.      * If you are using these forms make sure you pass UTF8 data
  85.      */
  86.     nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path);
  87.     void removeSubtree(in nsRegistryKey baseKey, in string path);
  88.     nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path);
  89.  
  90.     nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path);
  91.     void removeSubtreeRaw(in nsRegistryKey baseKey, in string path);
  92.     nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path);
  93.  
  94.     nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey);
  95.     nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey);
  96.     nsIEnumerator enumerateValues(in nsRegistryKey baseKey);
  97.     
  98.     const unsigned long String = 1;
  99.     const unsigned long Int32 = 2;
  100.     const unsigned long Bytes = 3;
  101.     const unsigned long File = 4;
  102.     
  103.     unsigned long getValueType(in nsRegistryKey baseKey, in string path);
  104.     PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
  105.     void deleteValue(in nsRegistryKey baseKey, in string path);
  106.  
  107.     /**
  108.      * escapeKey() takes arbitrary binary data and converts it into
  109.      * valid ASCII which can be used as registry key or value names
  110.      */
  111.     void escapeKey([array, size_is(length)] in PRUint8 key, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 escaped); 
  112.     void unescapeKey([array, size_is(length)] in PRUint8 escaped, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 key); 
  113.  
  114.     attribute string currentUserName;
  115.  
  116.     void pack();
  117. };
  118.  
  119. [scriptable, uuid(8cecf236-1dd2-11b2-893c-f9848956eaec)]
  120. interface nsIRegistryEnumerator : nsIEnumerator
  121. {
  122.     void currentItemInPlaceUTF8(out nsRegistryKey key,
  123.                                 [shared, retval] out string item);
  124. };
  125.  
  126. [scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
  127. interface nsIRegistryNode : nsISupports
  128. {
  129.     readonly attribute string nameUTF8;
  130.     readonly attribute wstring name;
  131.     readonly attribute nsRegistryKey key;
  132. };
  133.  
  134. [scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
  135. interface nsIRegistryValue : nsISupports
  136. {
  137.     readonly attribute wstring name;
  138.     readonly attribute string nameUTF8;
  139.     readonly attribute unsigned long type;
  140.     readonly attribute PRUint32 length;
  141. };
  142.  
  143. [uuid(3A15FC88-7A61-4Ab4-8E58-31E95fAB3DA8)]
  144. /**
  145.  * It sucks that nsIRegistry has to always allocate and return
  146.  * strings. nsIRegistryGetter adds in interfaces for non allocating getters
  147.  * to registry values.
  148.  */
  149. interface nsIRegistryGetter : nsISupports
  150. {
  151.     /**
  152.      * Get a string value of attribute valname in widestring or utf8 format
  153.      *
  154.      * @return
  155.      *  NS_OK on success.
  156.      *    buf has the string value copied into it. length is NOT changed.
  157.      *  NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
  158.      *    length is updated to actual length in chars including
  159.      *    terminating NULL and buf will be unchanged.
  160.      *  NS_ERROR_FAILURE if an unknown error happened. state of buf and
  161.      *    length undefined.
  162.      *  various failure codes otherwise. buf and length wont be updated.
  163.      */
  164.     void getStringUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
  165.                                  inout char buf, inout PRUint32 length);
  166.  
  167.     /**
  168.      * Get a a byte array value of attribute valname
  169.      *
  170.      * @return
  171.      *  NS_OK on success. buf has the string value copied into it.
  172.      *    length is updated to actual number of bytes copied into buf.
  173.      *  NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
  174.      *    length is updated to actual length in PRUint8s including
  175.      *    terminating NULL and buf will be unchanged.
  176.      *  NS_ERROR_FAILURE if an unknown error happened. state of buf and
  177.      *    length undefined.
  178.      *  various other failure codes otherwise. buf and length wont be updated.
  179.      */
  180.     void getBytesUTF8IntoBuffer(in nsRegistryKey baseKey, in string path,
  181.                                 inout PRUint8 buf, inout PRUint32 length);
  182. };
  183.  
  184. %{ C++
  185. #include "nsIRegistryUtils.h"
  186. %}
  187.